import { random } from './random';

const md5 = require('md5');
export const signFunc = (
  timestamp: string,
  param: string,
  nonce: string,
): string => {
  let sign = '';
  const simpleSignArray = md5(timestamp + param + nonce).split('');
  console.log('simpleSignArray:', timestamp + param + nonce);
  const tnonceArray = (timestamp + nonce).split('');
  simpleSignArray.forEach((chars, index) => {
    let concatStr = chars;
    // 将tnonceArray +1方式插入simpleSignArray
    concatStr += tnonceArray[index] || '';
    sign += concatStr;
  });
  return sign;
};
